package cn.sdormitory.basedata.dao;

import cn.sdormitory.basedata.entity.BDormitory;
import cn.sdormitory.basedata.vo.BDormitoryVO;
import cn.sdormitory.basedata.vo.TeacherDorVO;
import cn.sdormitory.sys.entity.SysDictDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @创建人：zhouyang
 * @创建时间：2020/11/7 20:16
 * @version：V1.0
 */
@Mapper
public interface BDormitoryDao extends BaseMapper<BDormitory> {
    List<BDormitory> getBDormitoryListByCol(@Param("buildingNo")String buildingNo, @Param("storey")String storey);
    List<BDormitory> getBDormitoryList(@Param("buildingNo")String buildingNo,@Param("storey")String storey,@Param("dormitoryNo")String dormitoryNo, @Param("status")String status,@Param("currIndex")int currIndex,@Param("pageSize")int pageSize);
    List<BDormitoryVO> getAppDormitoryList();
    List<BDormitoryVO> getAppDorListByStorey(@Param("buildingNo")String buildingNo, @Param("storey")String storey);
    Long getAppDorListByDorNo(@Param("buildingNo")String buildingNo,@Param("storey")String storey,@Param("dormitoryNo")String dormitoryNo);

    /**
     * 查询宿舍楼栋
     * @return
     */
    @Select("SELECT dict_label,dict_value FROM sys_dict_detail WHERE dict_type='sys_building'")
    List<SysDictDetail> findDormBuilding();

    /**
     * 查询宿舍楼层
     * @return
     */
    @Select("SELECT dict_label,dict_value FROM sys_dict_detail WHERE dict_type='sys_storey'")
    List<SysDictDetail> findDormStorey();

    @Select("SELECT dormitory_no FROM b_dormitory WHERE building_no = #{buildingNo} AND storey = #{storey} AND `status` = '1'")
    List<String> findDorm(@Param("buildingNo")String buildingNo,@Param("storey")String storey);

    List<BDormitoryVO> getAllDormitory();

    /**
     * 查询正在使用的宿舍楼栋
     * @return
     */
    List<BDormitoryVO> getBDormitoryBuildingNo();

    /**
     * 查询正在使用的宿舍楼栋所正在使用的楼层
     * @param buildingNo
     * @return
     */
    List<BDormitoryVO> getBDormitoryStoreyByBuildingNo(String buildingNo);

    /**
     * 根据班主任id查询对应宿舍信息
     * @param teacherId 班主任id
     * @return 宿舍信息
     */
    List<TeacherDorVO> getTeacherDor(Long teacherId);
}
